function getValue(id) {
    return document.getElementById(id).value;
}
function checkuser() {
    if(getValue('uname') == "luo123" && getValue('pwd') == "00000") {
        return true;
    }else {
        alert("登录名或密码错误！")
        return false;
    }
}

//用户名正则
var uname = document.getElementById("uname");
var span = document.getElementById("span");
var regexp = /^[a-zA-Z0-9_-]{6,16}$/;
uname.onblur = function () {
    if (regexp.test(this.value)) {
        console.log('正确的');
        span.className = 'right';
        span.innerHTML = '';
    } else {
        console.log('错误的');
        span.className = 'wrong';
        span.innerHTML = '用户名格式输入不正确';
    }
}

